package com.arithmeticEveryDay.__1_enumeration;

/*

求N！末尾0的个数

输入
1
5
10

输出
0
1
2

算法二的原理：
只有当因子是5和偶数相乘时才会出现末尾是零，
而一个5和任意一个偶数(除10的倍数外)相乘都能得到一个末尾为一个0的数,
但为什么只需要数5的个数而不需要数偶数的个数呢？
因为N!中偶数的个数肯定是比5的个数多的
 

 */

import java.util.Scanner;

public class __1_TheSumOfZeroInFactorial {

    public static void main(String[] args) {
        // TODO Auto-generated method stub
        {/*
            Scanner scan = new Scanner(System.in);
            while (scan.hasNext()) {
                int N = scan.nextInt();
                long factorial = 1;
                for (int i = 2; i <= N; i++) {
                    factorial *= i;
                }
                int count = 0;
                while (factorial % 10 == 0) {
                    count++;
                    factorial /= 10;
                }
                System.out.println(count);
            }
            */
        }
        {
            Scanner scan = new Scanner(System.in);
            while (scan.hasNext()) {
                int N = scan.nextInt();
                int count = 0;
                for (int i = 1; i <= N; i++) {
                    int m = i;
                    while (m % 5 == 0) {
                        count++;
                        m /= 5;
                    }
                }
                System.out.println(count);
            }
        }
    }
}